
import java.util.Scanner;

class TOMADA13 {

    static Scanner entrada = new Scanner(System.in);

    public static void main(String[] args) {
        int T = 0, i = 0;
        while (i++ < 4) {
            T += entrada.nextInt();
        }
        System.out.println(T - 3);
    }
}
